package com.airy.apprepairequipment.controller;


import com.airy.apprepairequipment.common.utils.PageUtils;
import com.airy.apprepairequipment.common.utils.R;
import com.airy.apprepairequipment.entity.DevConfigEntity;
import com.airy.apprepairequipment.service.DevConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * ${comments}
 *
 * @author dingyakun
 * @email 821041490@qq.com
 * @date 2020-11-24 16:04:13
 */
@RestController
@RequestMapping("product/devconfig")
public class DevConfigController {
    @Autowired
    private DevConfigService devConfigService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = devConfigService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{fstrDeviceid}")
    public R info(@PathVariable("fstrDeviceid") String fstrDeviceid){
		DevConfigEntity devConfig = devConfigService.getById(fstrDeviceid);

        return R.ok().put("devConfig", devConfig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody DevConfigEntity devConfig){
		devConfigService.save(devConfig);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody DevConfigEntity devConfig){
		devConfigService.updateById(devConfig);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] fstrDeviceids){
		devConfigService.removeByIds(Arrays.asList(fstrDeviceids));

        return R.ok();
    }

}
